package com.cms.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cms.entity.WechatMenu;
import com.cms.mapper.WechatMenuMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 微信菜单表 服务实现类
 * </p>
 *
 * @author songfayuan
 * @since 2021-11-12
 */
@Service
public class WechatMenuService extends ServiceImpl<WechatMenuMapper, WechatMenu> {

    /**
     * 查找顶级微信菜单
     *
     * @return 顶级微信菜单
     */
    public List<WechatMenu> findRoots(){
        QueryWrapper<WechatMenu> queryWrapper = new QueryWrapper();
        queryWrapper.isNull("parentId");
        queryWrapper.orderByDesc("sort");
        return baseMapper.selectList(queryWrapper);
    }
}
